#include <iostream>
#include <algorithm>

#include "testlib.h"

using namespace std;

const int maxN = 10001;

int mas[maxN];


int main(int argc, char **argv) {
    setName("patience problem checker");
    registerTestlibCmd(argc, argv);
    	int n = inf.readInt();
	for(int i = 0; i < n; i++)
		mas[i] = ouf.readInt();
        int sum = -100000000;
	for(int i = 0; i < n - 1; i++)
		sum = max (sum, mas[i]+mas[i+1]);
        sort(mas,mas+n);
	for(int i = 0; i < n; i++)
             if (i + 1 != mas[i]) 
			quitf(_wa, "Number set mismatch: %d-th number is %d", i + 1, mas[i]);
        if (n + 1 <  sum) quitf (_wa, "Jury's better: %d instead of %d", n + 1, sum);
        quitf(_ok, "n = %d", n);
}
